FROM openjdk:21-jdk-slim

# 设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

MAINTAINER Annie
ENV JAVA_OPT="-Xms1024m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./ -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseG1GC"
ENV JAVA_ARG="--spring.profiles.active=prod --user.timezone=$TZ"

ADD target/*.jar /opt/app.jar
EXPOSE 7747
CMD ["sh", "-c", "exec java $JAVA_OPT -jar /opt/app.jar $JAVA_ARG"]
